package com.tulei.api.crawler;

import org.jsoup.Connection;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

/**
 * @Author TuLei
 * @Date 2024-06-25 20:26
 **/

public class Beike {

    public static void main(String[] args) {

        Connection connect = Jsoup.connect("https://www.google.com/");
        Document document = null;
        try {
            document = connect.get();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }

        System.out.println(11);

    }

    private static List<String> extracted(int i) {
        Connection connect = Jsoup.connect("https://wh.fang.ke.com/loupan/pg"+i+ "/");
        Document document = null;
        List<String> list = new ArrayList<>();
        try {
            document = connect.get();
            Elements elements = document.getElementsByClass("resblock-list-wrapper");
            Elements liList = elements.get(0).getElementsByTag("li");
            for (Element element : liList) {
                Element aElement = element.selectFirst("img");
                if (aElement != null) {
                    String attr = aElement.attr("data-original");
                    list.add(attr);
                }
            }
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        return list;
    }
}
